'use strict';

/**
 * @name common router
 * @description common router
 * @author yud
 */

angular.module('metalabOperationApp').
config(function ($stateProvider, $urlRouterProvider, $provide) {
    $provide.decorator('$uiViewScroll', function () {
        return function (uiViewElement) {
            //$('body').animate({ //    scrollTop: uiViewElement.offset().top - 200 //}, 0);
            document.body.scrollTop = uiViewElement.offset().top - 200;
        };
    });

    $stateProvider
        .state('meta', {
            url: '',
            abstract: true,
            resolve: {
                passport: function ($rootScope) {
                    return $rootScope.passportPromise.promise;
                }
            },
            views: {
                '': {
                    template: '<div ui-view></div>'
                }
            }
        });
    $urlRouterProvider.when('', '/');
    $urlRouterProvider.otherwise('/');

});
